package easy;

import util.PrintUtils;

public class Solution_1317 {

    public int[] getNoZeroIntegers(int n) {
        StringBuffer a = new StringBuffer();
        StringBuffer b = new StringBuffer();
        int high_bit = 0;
        while (n > 0) {
            if (high_bit == 1 && n == 1) {
                break;
            }
            int mod = n % 10;
            if (high_bit == 1) {
                if (mod > 0) {
                    mod--;
                    high_bit = 0;
                } else {
                    mod = 9;
                }
            }
            if (mod > 1 || n < 10) {
                a.append(1);
                b.append(mod - 1);
            } else {
                high_bit = 1;
                a.append(1 + mod);
                b.append(9);
            }
            n /= 10;
        }
        return new int[]{Integer.parseInt(a.reverse().toString()), Integer.parseInt(b.reverse().toString())};
    }

    public static void main(String[] args) {
        Solution_1317 model = new Solution_1317();
        PrintUtils.arrayInt(model.getNoZeroIntegers(19));
        PrintUtils.arrayInt(model.getNoZeroIntegers(2));
        PrintUtils.arrayInt(model.getNoZeroIntegers(11));
        PrintUtils.arrayInt(model.getNoZeroIntegers(10000));
        PrintUtils.arrayInt(model.getNoZeroIntegers(69));
        PrintUtils.arrayInt(model.getNoZeroIntegers(1010));
    }
}
